<template>
  <up-list-item :isLink="false">
    <up-swipe-action>
      <up-swipe-action-item
        v-model:show="props.deviceItem.show"
        :name="props.deviceItem.name"
        :options="activeOptions"
        @click="(res) => swipeActionClickHandler(res, props.deviceItem)"
      >
        <slot></slot>
      </up-swipe-action-item>
    </up-swipe-action>
  </up-list-item>
</template>

<script setup lang="ts">
import { onLoad } from "@dcloudio/uni-app";
import type { PropType } from 'vue';
import type { IDeviceItem } from '@/types/deviceType';

interface IProps {
  deviceItem: IDeviceItem;
}

const props = defineProps<IProps>()

const activeOptions = [
  { text: '查看', style: { backgroundColor: '#ff9999' } },
  { text: '编辑', style: { backgroundColor: '#f53d3d' } },
  { text: '操作', style: { backgroundColor: '#f53d3d' } },
]
const swipeActionClickHandler = (res: any, item: any) => {
  console.log('swipeActionClickHandler', res, item);
}
</script>

<style scoped lang="scss">
.swipe-action-container {
  .swipe-action__content__text {
    height: 48px;
    font-size: 14px;
    line-height: 48px;
  }
}
</style>
